﻿

// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License.
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
// All other rights reserved.

using System;
using System.Collections.Generic;
using System.Web.Services;
using System.Data;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
    public AutoComplete()
    {
    }
    ConnectUnit conn = new ConnectUnit("localhost", "sa", "sa", "FlyWaySystem");
    [WebMethod]
    public string[] GetCompletionList(string prefixText)
    {

        DataSet ds = conn.Select("FlightInformation");
        DataTable dataTable = ds.Tables[0];        
        List<string> items = new List<string>();
        foreach (DataRow row in dataTable.Rows) {
            items.Add(row[1].ToString());
        }
        return items.ToArray();
    }
}
